
/* eslint-disable */
import flv from './flv.min.js'
export default{
    data(){
        return {
            flvPlayer:null,
        }
    },
    methods:{
        flvStartVideo(dom, url){
            if(this.flvPlayer) this.flvDisposeVideo();
            this.flvPlayer = flv.createPlayer({
                type: 'flv',
                isLive: true,
                // hasAudio: true,
                // hasVideo: true,
                enableStashBuffer: true,
                url: url,
                fixAudioTimestampGap: false, 
            });
            this.flvPlayer.attachMediaElement(dom);
            this.flvPlayer.load();
            this.flvPlayer.play();
            this.flvPlayer.on('error', (e)=>{
                this.playerBigBtn.style.display = 'block';
                console.log('error', e)
            })
      

        },
        flvDisposeVideo(){
            if(!this.flvPlayer) return;
            this.flvPlayer.pause();
            this.flvPlayer.unload();
            this.flvPlayer.detachMediaElement();
            this.flvPlayer.destroy();
            this.flvPlayer = null;
        }
    }
}